#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QVBoxLayout>
#include <QLabel>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMovie>
#include <QTimer>
#include <QHBoxLayout>
#include <QMutex>
#include "../audiorecorder/audiorecorder.h"
#include "../asr/asr.h"
#include "../led/led.h"
#include "../facedetection/facedetection.h"

class Asr;
class AudioRecorder;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void showText(const QString &text);
    void switchButtonStatus(bool t);

private:
    Ui::MainWindow *ui;
    QTcpServer* server;
    QTcpSocket* socket;

    /* 定时器 */
    QTimer *timer1;
    QTimer *timer2;
    QTimer *timer3;

    QByteArray imageArray;


    /* 录音类 */
    AudioRecorder *myAudioRecorder;

    /* 主意识别类 */
    Asr *myAsr;

    facedetection * myfacedection;

    /* 开发板LED */
    Led *myLed;

    bool addFaceMode = false;

    QString curUserName = "";

signals:
    void successFoundName(QString);

private slots:
    void onTimer1TimeOut();
    void onTimer2TimeOut();
    void onTimer3TimeOut();
    void onAsrReadyData(QString);

    void onFaceRes(int, bool, QString);
    void onSuccessFoundName(QString);

    void on_pushButton_Listen_clicked();

    void server_New_Connect();

    void socket_Read_Data();

    void socket_Disconnected();

    void on_voiceButton_clicked();

    void on_voiceButton_2_clicked();

    void on_LED_open_Button_clicked();
    void on_LED_open_Button_2_clicked();
    void on_open_door_Button_clicked();
    void on_open_door_Button_2_clicked();
    void on_add_face_Button_clicked();
    void on_show_list_Button_clicked();
    void on_show_list_Button_2_clicked();
    void on_del_face_Button_clicked();
    void on_del_face_Button_2_clicked();
};


#endif // MAINWINDOW_H
